var deleteID='';
var vm = new Vue({
    el: "#app",
    data:
        {
            pageModel: '',
            messages: ''
        },
    // 方法存放区
    methods: {
        send() {
            axios({
                method: 'POST',
                url: '/unread/get'
            }).then(function (res) {
                vm.pageModel = res.data;
                vm.messages = res.data.data;
            }).catch(function (reason) {
                console.log(reason);
            })
        },
        // 删除
        delectCheck(informationId) {
            deleteID=informationId
            $(".tip").fadeIn(200);
        },
        // 修改留言
        updateMessage(informationId) {
            window.location.href="updateUnRead.html?no="+informationId
        },
        // 查询留言
        getOne(informationId) {
            window.location.href="unReadView.html?no="+informationId
        },
        // 删除确认
        delectCheck2() {
            axios.post('/unread/delete/'+deleteID)
                .then(function (response) {
                    alert(response.data)
                    vm.send()
                })
                .catch(function (error) {
                    alert(response.data)
                });
    },//点击分页
    clickPageModel(num) {
        var s1 = $("input[name='messageIntro']").val();
        var s2 = $("input[name='sender']").val();
        var s3 = $("input[name='accept']").val();
        axios({
            method: 'POST',
            url: '/unread/get',
            params: {
                "title": s1,
                "sender":s2,
                "receiver":s3,
                "pageNum": num
            }
        }).then(function (res) {
            vm.pageModel = res.data;
            vm.messages = res.data.data;
        }).catch(function (reason) {
            console.log(reason);
        })
    }
    },
    //页面加载完自动执行
    mounted() {
        this.send();
    }
});

